<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>国省自检--${fns:getConfig('productName')}</title>
<link rel="stylesheet" href="${ctx}/styles/gsjcss/common.css">
<script type="text/javascript">
function btnClick(){
	var url = '${ctx}/maintenanceMony/search.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}';
	var data = {};
	if($('#btnSearch').length>0){ //有搜索按钮的情况下 获取条件进行搜索
		//将条件提取出来 
		//将条件存入data中
		//ajax请求   得到数据
		data['retrieval'] = getJson('condition');
		loadData(url,data);
	} else {
		loadData(url,data);
	}
}
//ajax执行成功之后的回调方法
function loadDataToTable(data){
	var attment = data['att'];
	var detail = data['detail'];
	var overView = data['overView'];
	if($('#yhzj_zjzl').length>0){
		$('#yhzj_zjzl tbody').empty();
		for (var j = 0; j < overView.length; j++) {
			var tr ="<tr><td>"+overView[j].projectName+"</td><td>"+overView[j].usePate+"</td><td>";
			if(overView[j].bulletinNumber > 0){
				tr += imgRight;
			} else {
				tr += imgError;
			}
			tr +="</td><td>"+overView[j].remark+"</td></tr>";
			$('#yhzj_zjzl tbody').append(tr);
		}
	}
	if($('#yhzj_ndzj').length>0){
		$('#yhzj_ndzj tbody').empty();
		for(var k = 0; k < detail.length; k++) {
			var tr ="<tr><td>"+detail[k].year+"</td><td>"+detail[k].cityMoney+"</td><td>"+detail[k].countyMoney+"</td>"+
					"<td>"+Pengtu.buildCodeName(1000,detail[k].isGrow)+"</td><td>"+Pengtu.buildCodeName(1000,detail[k].isReserved)+"</td><td>";
			if(detail[k].bulletinNumber > 0){
				tr += imgRight;
			} else {
				tr += imgError;
			}
			tr +="</td><td>"+detail[k].remark+"</td></tr>";		
			$('#yhzj_ndzj tbody').append(tr);
		}
	}
	
	loadAttachment(attment);
	
	
	//返回评分结果
	if(data['years'] != undefined){
		//每次搜索前清空表格
		$('#checkResult').empty();
		var yearDate = "";
		var detailDate ="";
		var result="";
		for( var k=0 ;k< overView.length; k++){
			result = '<tr><td>'+parseInt(k+1)+'</td><td>'+overView[k].projectName+'</td><td>'+overView[k].usePate+'%</td><td>'+data['projectMark']+'</td>';
		}
		for(var j = 0; j< detail.length; j++){
			result += '<td>'+detail[j].cityMoney+'</td><td>'+detail[j].countyMoney+'</td><td>'+Pengtu.buildCodeName(1000,detail[j].isGrow)+'</td><td>'+Pengtu.buildCodeName(1000,detail[j].isReserved)+'</td><td>'+data['yearMark'+j]+'</td>';
			yearDate += '<th colspan="5">'+detail[j].year+'</th>';
			detailDate += '<th>市级专项资金(元/公里)</th><th>县级专项资金(元/公里)</th><th>养护资金是否增长</th><th>是否预留应急抢险专项资金</th><th>年度得分</th>';
		}
			
		var content = '<table style="width:98%;text-align:center;margin-top:5px;" border="1"><thead><tr>'+
					  '<th rowspan="3">序号</th><th colspan="3">资金项目总览</th><th colspan="'+parseInt((detail.length)*5)+'">年度详情（年份）</th><th rowspan="3">检查得分</th><th rowspan="3">完善度</th></tr>'+
					  '<tr><th rowspan="2">资金项目</th><th rowspan="2">使用比例</th><th rowspan="2">项目得分</th>'+yearDate+'</tr>'+
					  '<tr>'+detailDate+'</tr>'+
					  '</thead><tbody></tbody></table>';			  
		$('#checkResult').append(content);
		
		
		result += '<td class="sumTd">'+data['sum']+'</td><td class="perTd">'+data['percent']+'%</td></tr>';
		$('#checkResult tbody').append(result);
	}
	
	
}
</script>
</head>
<body>
	<div id="x_top"></div>
	<tags:message content="${msg}" />
	<c:if test="${not empty checkTable.id}">
		<div style="text-align:center">
			<a href="javascript:void(0);" class="btn btn-primary" onclick="downWord('${ctx}/maintenanceMony/downWord.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}');" id= "btnDown" role="button" ><div id="x_v"></div></a>
		</div>
	</c:if>
	<form id="checkForm" class="form-horizontal"  method="POST"  name="checkForm" action="${ctx}/maintenanceMony/save.do?left=${fns:encodeParam(left)}&parentId=${fns:encodeParam(parentId)}&projectId=${fns:encodeParam(projectId)}&menuId=${fns:encodeParam(menuId)}&leftChild=${fns:encodeParam(leftChild)}">
		<input type="hidden" name="token" value="${token}">
		<div id="show">
			<div id="showTable" class="showTable">
				<jsp:include page="/WEB-INF/views/check/common.jsp"/> 
				<div class="model">
					<div>
						<legend>三、检查条件及设置</legend>
						<div class="content-title" id="condition">
							<div style="margin-right:10px;">
								<span>养护资金项目:</span>
								<select name="projectIds" id="projectIds">
									<option value="">请选择</option>
									<c:forEach items="${fns:getMoneyOverViewGroupByProjectName(projectId)}" var="moneyOverView"  varStatus="idxStatus">
										<option value="${moneyOverView.id}">${moneyOverView.projectName}</option>
									</c:forEach>
								</select>
							</div>
							<div style="margin-right:10px;margin-top:5px;">
								<span>年度安排不少于500元/公里得分<font style="color:red;">*</font>：</span>
								<input type='text' name = "yearFull" id="yearFull" value="1.5" class="required conInput"/>
								<span>年度安排少于500元/公里得分<font style="color:red;">*</font>：</span>
								<input type='text' name = "yearPart" id="yearPart" value="0.75" class="required conInput"/>
							</div>
							<div style="float:left;margin-right:10px;margin-top:5px;">	
								<span>资金项目每减少一个百分点扣分<font style="color:red;">*</font>：</span>
								<input type='text' name = "poitMark" id="poitMark" value="0.5" class="required conInput"/>
								<span>预留应急资金得分<font style="color:red;">*</font>：</span>
								<input type='text' name = "reserveMark" id="reserveMark" value="2.5" class="required conInput"/>
							</div>
							<div id="x_s" style="float:right">
								<div class="x_ico"></div>
								<a href="#javascript:void(0)" onclick= "btnClick();"  id= "btnSearch" role="button" >搜索&nbsp;</a>
							</div>
						</div>
					</div>
				</div>
				<div class="model">
					<div>
						<legend>四、检索结果</legend>
						<div class="content-title">
							<div class="tabbox">
								<div class="tab">
									<c:forEach items="${childMenuList}" var="menu"  varStatus="idxStatus">
										<a href="javascript:;" <c:if test="${idxStatus.index == 0}">class="on"</c:if> >${menu.name}</a>
									</c:forEach>
							    </div>
							    <div class="content">
							    	<ul>
							    		<c:forEach items="${childMenuList}" var="menu"  varStatus="idxStatus">
							    			<li>
							    				<c:choose>
							    					<c:when test="${menu.tag eq 'yhzj_zjzl'}">
							    						<table style="width:99.8%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
							    							<thead>
										    					<th>资金项目</th>
										    					<th>使用比例(%)</th>
										    					<th>已上传养护资金/专项资金文件</th>
										    					<th>备注</th>
									    					</thead>
								    						<tbody>
									    						
									    					</tbody>
							    						</table>
							    					</c:when>
							    					<c:when test="${menu.tag eq 'yhzj_ndzj'}">
							    						<table style="width:99.8%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
									    					<thead>
										    					<th>年份</th>
										    					<th>市级政府专项资金(元/公里)</th>
										    					<th>县级政府专项资金(元/公里)</th>
										    					<th>养护资金是否增长</th>
										    					<th>预留应急抢险专项资金</th>
										    					<th>已上传养护资金/专项资金文件</th>
										    					<th>备注</th>
										    				</thead>
								    						<tbody>
									    						
									    					</tbody>
							    						</table>
							    					</c:when>
							    					<c:otherwise>
							    						<table style="width:99.8%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
									    					<thead>
									    						<th>序号</th>
										    					<th>操作</th>
										    					<th>发文单位</th>
										    					<th>上传用户</th>
										    					<th>文件名</th>
										    					<th>发文日期</th>
										    					<th>上传日期</th>
										    					<th>文件大小</th>
										    					<th>文件类型</th>
										    				</thead>
								    						<tbody>
									    						
									    					</tbody>
							    						</table>
							    					</c:otherwise>
							    				</c:choose>
							    			</li>
							    		</c:forEach>
							        </ul>
							    </div>
							</div>
						</div>
					</div>
				</div>
				<div class="model">
					<div>
						<legend>五、检查评分</legend>
						<div class="content-title" id="checkResult">
						
						</div>
					</div>
				</div>
				<div class="model">
					<div class="content-btn">
						<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" />
						&nbsp;&nbsp;&nbsp;&nbsp;
						<input id="btnCancel" class="btn" type="button" value="返 回" onclick="toBack()" />
					</div>
				</div>
			</div>
		</div>
	</form>
	<script src="${ctxStatic}/js/check/checkCommon.js" type="text/javascript"></script>
</body>
</html>